package org.rambadger.command.validation;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Validates that a collection does not contain any duplicate values
 */
@Target({ METHOD, FIELD, ANNOTATION_TYPE, PARAMETER })
@Retention(RUNTIME)
@Constraint(validatedBy = {UniqueCollectionValidator.class})
@Documented
public @interface Unique {
    String message() default "{org.rambadger.command.validation.Unique}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
